import java.util.*;

/**
 * Created by JiaJia on 2019/8/10 0010.
 */
public class Beike01 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int n=scanner.nextInt();
            int[] nums=new int[n];
            for (int i = 0; i <n ; i++){
                nums[i]=scanner.nextInt();
            }
            HashMap<Integer,Integer> map=new HashMap<>();
            List<Integer> list=new ArrayList<>();
            List<Integer> list2=new ArrayList<>();
            for (int i =0; i <n-1 ; i++) {
                int chazhi=Math.abs(nums[i]-nums[i-1]);
                map.put(i,chazhi);
            }
            for(Integer key:map.keySet()){
                list.add(map.get(key));
            }
            //Collection<Integer> coll=map.keySet();
           // list.addAll(coll);
            Collections.sort(list);
            int min=list.get(0);
            /*for(Integer key:map.keySet()){
                if(key==min){
                    list2.add(map.get(key));
                }
            }
            Collections.sort(list2);
            int result=list2.get(0);*/
            int result=0;
            for (int i = 0; i <n-1 ; i++) {
                if(Math.abs(nums[i]-nums[i+1])==min){
                    result=i;
                }
                continue;
            }
            System.out.println(nums[result]+" "+nums[result+1]);
        }
        scanner.close();
    }
}